package com.flycent.fanbao.ui;

import net.tsz.afinal.FinalActivity;
import net.tsz.afinal.annotation.view.ViewInject;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

import com.flycent.fanbao.App;
import com.flycent.fanbao.R;
import com.flycent.fanbao.ui.view.LabelView;
import com.flycent.fanbao.ui.view.RoundImage;

public class LabelViewActivity extends BackableTitleBarActivity{
	@ViewInject(id = R.id.image1) ImageView mImage;
	@ViewInject(id = R.id.button) Button mBut;
	@ViewInject(id = R.id.image2) ImageView mImage2;
	@ViewInject(id = R.id.image3) ImageView mImage3;
	@ViewInject(id = R.id.image4) RoundImage mImage4;
	@ViewInject(id = R.id.text) ImageView mTextBut;
	@ViewInject(id = R.id.round_side_bg) ImageView mRoundBg;
	@ViewInject(id = R.id.round_check_image) ImageView mRoundCheckImage;
	
	
	private boolean isCheck = true;

	@Override
	protected void onCreate(Bundle savedInstance) {
		super.onCreate(savedInstance);
		setContentView(R.layout.activity_lableview);
		getTitleBar().setTitle("图标");
		FinalActivity.initInjectedView(this);
		

		//------------------------------------------------
		final LabelView label = new LabelView(this);
		label.setText("CHINA");
		label.setBackgroundColor(0xffE91E63);
		label.setTargetView(mImage, 10, LabelView.Gravity.LEFT_TOP);

		mImage.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				label.remove();
				App.showShortToast("CHINA");
			}
		});
		
		//---------------------------------------------
		mImage4.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				if(isCheck){
					mRoundBg.setVisibility(View.INVISIBLE);
					mRoundCheckImage.setVisibility(View.INVISIBLE);
					isCheck = false;
				}else {
					mRoundBg.setVisibility(View.VISIBLE);
					mRoundCheckImage.setVisibility(View.VISIBLE);
					isCheck = true;
				}
				
			}
		});
		
		
		//---------------------------------------------
		final LabelView label1 = new LabelView(this);
		label1.setText("12");
		label1.setBackgroundColor(getResources().getColor(R.color.blue));
		label1.setTargetView(mBut, 4, LabelView.Gravity.LEFT_TOP);

		//---------------------------------------------
		final LabelView label2 = new LabelView(this);
		label2.setText("image");
		label2.setBackgroundColor(getResources().getColor(R.color.green));
		label2.setTargetView(mImage2, 6, LabelView.Gravity.LEFT_TOP);

		//---------------------------------------------
		final LabelView label3 = new LabelView(this);
		label3.setText("12");
		label3.setBackgroundColor(getResources().getColor(R.color.green));
		label3.setTargetView(mTextBut, 2, LabelView.Gravity.LEFT_TOP);


	}

}
